package com.jdd.modules.deviceConf.vo;

import com.jdd.modules.device.entity.TDevice;
import com.jdd.dao.entity.TProject;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * @Author: LS
 * @Date: 2022 - 09 - 27 - 14:58
 * @Description:
 * @version: 1.0
 */
@Data
@NoArgsConstructor
public class TDeviceConfTreeModal implements Serializable {
    private static final long serialVersionUID = 1L;
    /** 对应Tprojectg中的id字段,前端数据树中的key*/
    private String key;

    private String value;

    private String title;

    private boolean isLeaf;

    private String projectId;

    private String confId;

    private String deviceId;

    private String parentId;

    private String id;

    private Integer isDevice;

    private List<TDeviceConfTreeModal> children = new ArrayList<>();

    public TDeviceConfTreeModal(TProject tProject){
        this.id = tProject.getId();
        this.key = tProject.getId();
        this.value = tProject.getId();
        this.isDevice = 0;
        this.title =tProject.getName();
    }

    public TDeviceConfTreeModal(TDevice tDevice){
        this.id=tDevice.getId();
        this.key=tDevice.getId();
        this.value=tDevice.getId();
        this.isDevice = 1;
        
        this.parentId=tDevice.getProjectId();
        this.title=tDevice.getDeviceAlias();
    }
}
